<html>
<head>
	<meta charset="UTF-8">
	<meta content="IE=edge" http-equiv="X-UA-Compatible">
	<meta content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no, width=device-width" name="viewport">
	<title>2541：[Ctsc2000]冰原探险</title>
	<!-- css -->
	<link href="../css/base.min.css" rel="stylesheet">
	<link href="../css/project.min.css" rel="stylesheet">
	
	<!-- favicon -->
	<!-- ... -->
</head>
<body class="page-brand">
	<header class="header header-transparent header-waterfall ui-header">
		<ul class="nav nav-list pull-left">
			<li>
				<a data-toggle="menu" href="#menu">
					<span class="icon icon-lg">menu</span>
				</a>
			</li>
		</ul>
		<a class="header-logo header-affix-hide margin-left-no margin-right-no" data-offset-top="213" data-spy="affix">[Ctsc2000]冰原探险</a>
		<span class="header-logo header-affix margin-left-no margin-right-no" data-offset-top="213" data-spy="affix">[Ctsc2000]冰原探险</span>
	</header>
	<nav aria-hidden="true" class="menu" id="menu" tabindex="-1">
		<div class="menu-scroll">
			<div class="menu-content">
				<a class="menu-logo" href="../index.html">BZOJ离线题库</a>
				<ul class="nav">
					<li>
						<a class="waves-attach" data-toggle="collapse" href="#problems">题目</a>
						<ul class="menu-collapse collapse in" id="problems">
							<li>
								<a class="waves-attach" href="../index.html">主页</a>
							</li>
							<li>
								<a class="waves-attach" href="../list.html">题目列表</a>
							</li>
						</ul>
					</li>
					<li>
						<a class="collapsed waves-attach" data-toggle="collapse" href="#about">关于</a>
						<ul class="menu-collapse collapse" id="about">
							<li>
								<a class="waves-attach" href="../about.html">关于此项目</a>
							</li>
						</ul>
					</li>
					
				</ul>
			</div>
		</div>
	</nav>
	<main class="content">
		<div class="content-header ui-content-header">
			<div class="container">
				<h1 class="content-heading">
                [Ctsc2000]冰原探险                </h1>
                <p>时间限制：3s&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  空间限制：128MB</p>			</div>
		</div>
		<div class="container">
			<section class="content-inner margin-top-no">
				<div class="row">
					<div class="col-lg-13 col-md-13">
						<div class="card margin-bottom-no">
							<div class="card-main">
								<div class="card-inner">
									
                                <h3>题目描述</h3><p><p style="margin: 0cm 0cm 0pt; text-indent: 21pt" class="MsoNormal"><v:shapetype path="m,l,21600r21600,l21600,xe" o:spt="202" coordsize="21600,21600" id="_x0000_t202"><v:stroke joinstyle="miter"></v:stroke><v:path o:connecttype="rect" gradientshapeok="t"></v:path></v:shapetype><span style="font-size: 12pt; font-family: 宋体; mso-bidi-font-size: 10.0pt">传说中，南极有一片广阔的冰原，在冰原下藏有史前文明的遗址。整个冰原被横竖划分成了很多个大小相等的方格。在这个冰原上有<span lang="EN-US">N</span>个大小不等的矩形冰山，这些巨大的冰山有着和南极一样古老的历史，每个矩形冰山至少占据一个方格，且其必定完整地占据方格。冰山和冰山之间不会重叠，也不会有边或点相连。以下两种情况均是不可能出现的：</span></p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21pt" class="MsoNormal"><span style="font-size: 12pt; font-family: 宋体; mso-bidi-font-size: 10.0pt"><img alt="" src="../file/2541_0.jpg" /></span></p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21pt" class="MsoNormal"><span style="font-size: 12pt; font-family: 宋体; mso-bidi-font-size: 10.0pt"><span lang="EN-US"><o:p></o:p></span></span></p>
<p></p>
<p></p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21pt" class="MsoNormal"></p>
<p></p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21pt" class="MsoNormal"><span lang="EN-US" style="font-size: 12pt; font-family: 宋体; mso-bidi-font-size: 10.0pt">ACM</span><span style="font-size: 12pt; font-family: 宋体; mso-bidi-font-size: 10.0pt">探险队在经过多年准备之后决定在这个冰原上寻找遗址。根据他们掌握的资料，在这个冰原上一个大小为一格的深洞中，藏有一个由史前人类制作的开关。而唯一可以打开这个开关的是一个占据接近一格的可移动的小冰块。显然，在南极是不可能有这样小的独立冰块的，所以这块冰块也一定是史前文明的产物。他们在想办法把这个冰块推到洞里去，这样就可以打开一条通往冰原底部的通道，发掘史前文明的秘密。冰块的起始位置与深洞的位置均不和任何冰山相邻。</span><span style="font-size: 12pt; font-family: 宋体; mso-bidi-font-size: 10.0pt">这个冰原上的冰面和冰山都是完全光滑的，轻轻的推动冰块就可以使这个冰块向前滑行，直到撞到一座冰山就在它的边上停下来。冰块可以穿过冰面上所有没有冰山的区域，也可以从两座冰山之间穿过（见下图）。冰块只能沿网格方向推动。</span></p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21pt" class="MsoNormal"><span style="font-size: 12pt; font-family: 宋体; mso-bidi-font-size: 10.0pt"><span lang="EN-US"><o:p><img alt="" src="../file/2541_1.jpg" /></o:p></span></span></p>
<p><span style="font-size: 12pt; font-family: 宋体; mso-bidi-font-size: 10.0pt"><span lang="EN-US"> </span></span></p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21pt" class="MsoNormal"><span style="font-size: 12pt; font-family: 宋体; mso-bidi-font-size: 10.0pt">请你帮助他们以最少的推动次数将冰块推入深洞中。<span lang="EN-US"><o:p></o:p></span></span></p>
<p></p>
<p style="margin: 0cm 0cm 0pt; text-indent: 21pt" class="MsoNormal"></p></p><hr/><h3>输入格式</h3><p><p style="margin: 0cm 0cm 0pt" class="MsoNormal"><span style="font-size: 12pt; font-family: 宋体; mso-bidi-font-size: 10.0pt">输入文件第一行为冰山的个数<span lang="EN-US">N (1&lt;=N&lt;=4000)</span>，第二行为冰块开始所在的方格坐标<span lang="EN-US">X<sub>1</sub>,Y<sub>1</sub></span>，第三行为深洞所在的方格坐标<span lang="EN-US">X<sub>2</sub>,Y<sub>2</sub></span>，以下<span lang="EN-US">N</span>行每行有四个数，分别是每个冰山所占的格子左上角和右下角坐标<span lang="EN-US">X<sub>i1</sub>,Y<sub>i1</sub>,X<sub>i2</sub>,Y<sub>i2</sub><o:p></o:p></span></span></p>
<p style="margin: 0cm 0cm 0pt" class="MsoNormal"><span lang="EN-US" style="font-size: 12pt; font-family: 宋体; mso-bidi-font-size: 10.0pt"><o:p>&nbsp;</o:p></span></p></p><hr/><h3>输出格式</h3><p><p style="margin: 0cm 0cm 0pt" class="MsoNormal"><span style="font-size: 12pt; font-family: 宋体; mso-bidi-font-size: 10.0pt">输出文件仅包含一个整数，为最少推动冰块的次数。如果无法将冰块推入深洞中，则输出<span lang="EN-US">0</span>。<span lang="EN-US"><o:p></o:p></span></span></p></p><hr/><h3>样例输入</h3><pre>2
1 1
5 5
1 3 3 3
6 2 8 
</pre><hr/><h3>样例输出</h3><pre></pre><hr/><h3>提示</h3><p><p><a href="/JudgeOnline/upload/201604/2541.rar">数据如下：JudgeOnline/upload/201604/2541.rar</a></p></p><hr/><h3>题目来源</h3><p>没有写明来源</p>
								</div>
							</div>
						</div>
					</div>
				</div>
				
				
			</section>
		</div>
	</main>

	<div class="fbtn-container">
		<div class="fbtn-inner">
			<a class="fbtn fbtn-lg fbtn-brand-accent waves-attach waves-circle waves-light waves-effect" data-toggle="dropdown" aria-expanded="true"><span class="fbtn-text fbtn-text-left">Menu</span><span class="fbtn-ori icon">apps</span><span class="fbtn-sub icon">close</span></a>
			<div class="fbtn-dropup">
				<a class="fbtn fbtn-brand waves-attach waves-circle waves-light waves-effect" href="../list.html" target="_self"><span class="fbtn-text fbtn-text-left">题目列表</span><span class="icon">menu</span></a>
				<a class="fbtn fbtn-green waves-attach waves-circle waves-effect" href="../index.html" target="_self"><span class="fbtn-text fbtn-text-left">返回主页</span><span class="icon">home</span></a>
				<a class="fbtn waves-attach waves-circle waves-effect" href="http://www.lydsy.com/JudgeOnline/submitpage.php?id=2541" target="_blank"><span class="fbtn-text fbtn-text-left">提交代码</span><span class="icon">send</span></a>
				<a class="fbtn fbtn-orange waves-attach waves-circle waves-effect" href="http://www.lydsy.com/JudgeOnline/wttl/wttl.php?pid=2541" target="_blank"><span class="fbtn-text fbtn-text-left">试题讨论</span><span class="icon">chat</span></a>
				
			</div>
		</div>
	</div>

	<!-- js -->
	<script src="../js/jquery.min.js"></script>
	<script src="../js/base.min.js"></script>
	<script src="../js/project.min.js"></script>
</body>
</html>